package com.bll.imple.mymienAction;

import javax.servlet.ServletConfig;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.bean.MymienBean;
import com.bll.Action;
import com.bll.UploadAction;
import com.dao.MymienDao;

public class UpdateMymienStateAction implements Action{

	public String execute(HttpServletRequest request, HttpServletResponse response) {
		int state=Integer.parseInt(request.getParameter("state").toString());
		int id=Integer.parseInt(request.getParameter("mienid").toString());
		String lujing=request.getParameter("lujing");
		System.out.println("statelujing:"+lujing);
		System.out.println("state:"+state);
		MymienBean bean=new MymienBean();
		MymienDao dao=new MymienDao();
		MymienBean newbean=dao.SelectById(id);
		int type=newbean.getType();
		if(state==1){
			bean.setState(0);
			
			bean.setId(id);
			
			if(dao.UpdateState(bean)>0)
			System.out.println("sucsess");
		}else{
			bean.setState(1);
			bean.setId(id);
			if(dao.UpdateState(bean)>0)
			System.out.println("sucsess");
		}
		return "ShowMymien.mien"+"?lujing="+request.getParameter("lujing")+"&typeId="+type;
	}

}
